<extend name="Public:base" />
<block name="title">继续教育</block>
<block name="content">
    <input type="hidden" name="page" id="page">
    <div class="weui-panel__bd">
        <div class="weui-navbar">
            <foreach name="sort" item="vo">
                <!--<a href="__MODULE__/Article/learnlist/cateid/{$vo.id}" class='weui-navbar__item <if condition="$cateid eq $vo[id]">weui-bar__item_on</if>' data-id="{$vo.id}">-->
                <a href="javascript:;" class='weui-navbar__item' data-id="{$vo.id}">
                    {$vo.title}
                </a>
            </foreach>
        </div>
        <div class="weui-tab__panel">
            <div class="page__bd">
                <div class="weui-panel__bd" id="search_Result">
                <!--<a href="javascript:void(0);" class="weui-media-box weui-media-box_appmsg">
                    &lt;!&ndash;<div class="weui-media-box__hd">
                        <img class="weui-media-box__thumb" src="img/pic_article.jpg" alt="">
                    </div>&ndash;&gt;
                    <div class="weui-media-box__bd">
                        <div class="jx_fl">
                            <h4 class="weui-media-box__title">标题一</h4>
                            <p class="weui-media-box__desc">由各种物质组成的巨型球状天体，叫做星球。星球有一定的形状，有自己的运行轨道。</p>
                            <ul class="weui-media-box__info">
                                <li class="weui-media-box__info__meta">时间:2017/05/11</li>
                            </ul>
                        </div>
                        <div class="jx_fr">

                    		<span class="span_xiaz">
                    			下载
                            </span>
                            <ul class="weui-media-box__info">
                                <li class="weui-media-box__info__meta  fr">其它信息</li>
                            </ul>
                        </div>
                    </div>
                </a>-->

            </div>
                <div id="showmsg"></div>
                <input type="button" id="more" class="listmore" value="加载更多">
            </div>
        </div>
    </div>
    <script type="text/javascript">
        var page = $("#page").val();
        if(!page){
            page = 1;
        }
        $(".weui-navbar").children(":first").addClass('weui-bar__item_on');
        learn_list(page,1);
        $("#more").click(function(){
            var page = $("#page").val();
            var cateid = $(".weui-bar__item_on").attr('data-id');
            learn_list(page,cateid);
        });
        $(".weui-navbar__item").click(function(){
            var cateid = $(this).attr('data-id');
            $(".weui-navbar__item").removeClass('weui-bar__item_on');
            $(this).addClass('weui-bar__item_on');
            $("#search_Result").html('');
            $("#more").show();
            learn_list(page,cateid);
        });
        function learn_list(page,cateid){
            $.ajax({
                type:'post',
                url:'__MODULE__/Article/learnlist',
                data:{page:page,cateid:cateid},
                cache:false,
                dataType:'json',
                success:function(res){
                    if (res.code == 0) {
                        var arr = res.data;
                        var str = '';
                        $.each(arr, function (i) {
                            str += '<a href="' + this.file + '" class="weui-media-box weui-media-box_appmsg"><div class="weui-media-box__bd"> <div class="jx_fl"><h4 class="weui-media-box__title">' + this.title + '</h4><p class="weui-media-box__desc">' + this.smalltext + '</p><ul class="weui-media-box__info"><li class="weui-media-box__info__meta">' + this.addtime + '</li> </ul> </div> <div class="jx_fr"><span class="span_xiaz">下载</span><ul class="weui-media-box__info"><!--<li class="weui-media-box__info__meta  fr">其它信息</li>--> </ul> </div></div></a>';
                        });
                        $("#page").val(res.page);
                        $("#search_Result").append(str);
                    } else {
                        var str2 = '';
                        str2 += '<div class="nomore"><p>' + res.msg + '</p></div>';
                        $("#search_Result").append(str2);
                        $("#more").hide();
                    }
                }
            });
        }
    </script>
</block>